using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Game_Panel : Panel_Base
{
    public Text boxCountRatio_Text;
    public Text countDown_Text;

    public float countDownInitSize = 0.1f;
    public AnimationCurve countDownSizeCurve;
    // Start is called before the first frame update
    void Start()
    {
        EventManager.Instance.Regist(GameManager.GameEventType.BoxCountChange.ToString(), this.GetInstanceID(), (objects) => {
            SetBoxCountRatio((string)objects[0]);
        });
    }
    private void OnDestroy()
    {
        EventManager.Instance?.UnRegist(GameManager.GameEventType.BoxCountChange.ToString(), this.GetInstanceID());
    }
    // Update is called once per frame
    void Update()
    {
        
    }
    public void SetBoxCountRatio(string content)
    {
        boxCountRatio_Text.text = content;
    }
    public void ShowCountDown(float time)
    {
        countDown_Text.text = Mathf.CeilToInt(time).ToString();
        countDown_Text.transform.localScale=Vector3.one*Mathf.Lerp(countDownInitSize,1, countDownSizeCurve.Evaluate(( time%1)/1));
    }
}
